package com.googlecode.horncomb.orm.ibatis;

import java.io.Serializable;
import java.util.Collection;

import com.googlecode.horncomb.orm.dao.EntityBaseDao;
import com.googlecode.horncomb.orm.dao.EntityQueryDao;
import com.googlecode.horncomb.orm.support.order.Order;
import com.googlecode.horncomb.orm.support.paged.PagedList;

/**
 * SqlMap Enitity DAO Interfaces
 * @author Daniel
 */
public interface SqlMapEntityDao<T extends Serializable> extends
		EntityBaseDao<T>, EntityQueryDao<T> {

	/**
	 * query by a instance
	 * @param example
	 *            the instance
	 * @param order
	 *            result order
	 * @param page
	 *            the number of result
	 * @param pageSize
	 *            the size in one page
	 * @return the paged list of result
	 */
	public PagedList<? extends Collection<T>> queryByExample(T example,
			Order order, int page, int pageSize);

	/**
	 * query count by a instance
	 * @param example
	 *            the instance for query
	 * @return the count of result
	 */
	public int queryCountByExample(T example);

	/**
	 * query by a instance, not paed
	 * @param example
	 *            the instance for query
	 * @param order
	 *            result order
	 * @return the list of result object
	 */
	public Collection<T> queryByExample(T example, Order order);

	/**
	 * set the name of delete statement
	 * @param name
	 *            the name of delete statement
	 */
	public void setDeleteStatementName(String name);

	/**
	 * set the name of get statement
	 * @param name
	 *            the name of get statement
	 */
	public void setGetStatementName(String name);

	/**
	 * set the name of insert statement
	 * @param name
	 *            the name of insert statement
	 */
	public void setInsertStatementName(String name);

	/**
	 * set the name of update statement
	 * @param name
	 *            the name of update statement
	 */
	public void setUpdateStatementName(String name);

	/**
	 * set the name of query statement
	 * @param name
	 *            the name of query statement
	 */
	public void setQueryStatementName(String name);

	/**
	 * set the name of query count statement
	 * @param name
	 *            the name of query count statement
	 */
	public void setQueryCountStatementName(String name);

	/**
	 * @param entityClass
	 */
	public void setEntityClass(Class<?> entityClass);

	/**
	 * set namespace of sqlmap
	 * @param namespace
	 *            the namespace of sqlmap
	 */
	public void setNamespace(String namespace);

	/**
	 * set using namespace or not
	 * @param useStmtNamespaces
	 *            using or not
	 */
	public void setUseStatementNamespaces(boolean useStmtNamespaces);
}
